home *** CD-ROM | disk | FTP | other *** search
/ Workplace Effectiveness:…ecision-Making Strategies / Workplace Effectiveness: Decision-Making Strategies.iso / pc / Files / Review.dxr / 00033_set One of a Group.ls < prev    next >
Encoding:
Text File  |  1998-12-16  |  1.6 KB  |  41 lines

  1. property firstSprite, buttonNum, questionNum
  2. global gReviewData
  3.  
  4. on beginSprite me
  5.   set the buttonNum of me to the spriteNum of me - (the firstSprite of me - 1)
  6.   setPrevChoice(me)
  7. end
  8.  
  9. on setPrevChoice me
  10.   set chosenOne to getAt(the userdata of gReviewData, the questionNum of me)
  11.   if chosenOne = the buttonNum of me then
  12.     sendSprite(the spriteNum of me, #Toggle)
  13.   end if
  14. end
  15.  
  16. on mouseDown me
  17.   set chosenOne to getAt(the userdata of gReviewData, the questionNum of me)
  18.   if chosenOne = the buttonNum of me then
  19.     setAt(the userdata of gReviewData, the questionNum of me, 0)
  20.   else
  21.     if chosenOne <> 0 then
  22.       unclickAnother(me, chosenOne)
  23.     end if
  24.     setAt(the userdata of gReviewData, the questionNum of me, the buttonNum of me)
  25.   end if
  26. end
  27.  
  28. on unclickAnother me, prevChoice
  29.   set otherSprite to the firstSprite of me + (prevChoice - 1)
  30.   sendSprite(otherSprite, #Toggle)
  31. end
  32.  
  33. on getPropertyDescriptionList
  34.   set p_list to [#questionNum: [#comment: "Question number for this button:", #format: #integer, #range: [#min: 1, #max: 25], #default: 1], #firstSprite: [#comment: "First sprite of series:", #format: #integer, #range: [#min: 10, #max: 20], #default: 10]]
  35.   return p_list
  36. end
  37.  
  38. on getBehaviorDescription
  39.   return "Each sprite will know its position in a group based on its sprite number." & RETURN & "It will also know what question it is applied to." & RETURN & "From these properties we can keep score in a global." & RETURN & "‚Ä¢ Question number - choose from the range." & RETURN & "‚Ä¢ First sprite - so the first sprite in the series gets a 1, etc." & RETURN & "NOTES:" & RETURN & "Uses global variable to keep track of button position, ON or OFF."
  40. end
  41.